﻿//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using Nature.Numerics;
//using Nature.Numerics.Basic;
//using Nature.Internal;

//namespace Nature.MixExpression
//{
//    class EntropyConservationLawTemperatureFunction : IFunction
//    {
//        enum Mode
//        {
//            FixedPressure,
//            CompressionRatio
//        }

//        #region Private Fields
//        private CompositionObject m_composition;
//        private double m_constantPart;
//        private double m_baseTemperature;
//        Mode m_mode;
//        #endregion

//        internal void Configure(CompositionObject composition, Temperature baseTemperature, Pressure basePressure, Pressure fixedPressure)
//        {
//            m_mode = Mode.FixedPressure;
//            m_composition = composition;
//            // constant part = s0 - R * log(P0/P)
//            // function = [s0 - R * log(P0/P)] - s
//            m_constantPart = composition.CalcEntropy(baseTemperature) - 
//                Constants.Rgas * Math.Log(basePressure / fixedPressure);
//        }

//        internal void Configure(CompositionObject composition, double baseTemperature, double basePressure, CompressionRatio compressionRatio)
//        {
//            m_mode = Mode.CompressionRatio;
//            m_composition = composition;
//            m_baseTemperature = baseTemperature;
//            // constant part = s0 + R * log(compression ratio)
//            // function = [s0 + R * log(compression ratio)] - s - R * log(T0/T)
//            m_constantPart = composition.CalcEntropy(baseTemperature) +
//                Constants.Rgas * Math.Log(compressionRatio);
//        }

//        #region IFunction Members

//        public double Compute(double temperature)
//        {
//            double ds = m_constantPart - m_composition.CalcEntropy(temperature);
//            if (m_mode == Mode.CompressionRatio)
//            {
//                ds += Constants.Rgas * Math.Log(temperature / m_baseTemperature);
//            }
//            return ds;
//        }

//        #endregion
//    }

//    class EntropyConservationLawTemperatureSolver : Newton<EntropyConservationLawTemperatureFunction>
//    {
//        internal EntropyConservationLawTemperatureSolver()
//            : base(new EntropyConservationLawTemperatureFunction() )
//        {
//            base.AbsRadius = 50.0;
//            base.RelRadius = 0.3;
//        }
//    }

//}
